<html>
  <script src="../../lib/elk-api.js"></script>
  <script type="text/javascript">
    const elk = new ELK({
      workerUrl: '../../lib/elk-worker.js'
    })

    const graph = {
      id: "root",
      properties: { 'algorithm': 'layered' },
      children: [
        { id: "n1", width: 30, height: 30 },
        { id: "n2", width: 30, height: 30 },
        { id: "n3", width: 30, height: 30 }
      ],
      edges: [
        { id: "e1", sources: [ "n1" ], targets: [ "n2" ] },
        { id: "e2", sources: [ "n1" ], targets: [ "n3" ] } 
      ]
    }
    
    elk.layout(graph)
       .then(function(g) {
         document.body.innerHTML = "<pre>" + JSON.stringify(g, null, " ") + "</pre>"
       })
  </script>
</html>